home *** CD-ROM | disk | FTP | other *** search
/ The Programmer Disk / The Programmer Disk (Microforum).iso / xpro / qb2 / pro16 / wdchs.bas < prev    next >
BASIC Source File  |  1992-02-06  |  8KB  |  171 lines

  1. ' WDCHS.Bas
  2. ' Portions Copyright 1987-1990 Microsoft Corp.
  3. WindowDoComputeHotSpots:
  4.     numHSClick = 0
  5.     numHSRel = 0
  6.  
  7.     ' ====================================================================
  8.     ' If upper left corder of border is "=", then that's a close box
  9.     ' Furthermore, a close box is a release type event so store in HSRel
  10.     ' ====================================================================
  11.  
  12.     IF MID$(border$, 1, 1) = "=" THEN
  13.       numHSRel = numHSRel + 1
  14.       HSRel(numHSRel).row1 = GloWindow(windo).row1 - 1
  15.       HSRel(numHSRel).row2 = GloWindow(windo).row1 - 1
  16.       HSRel(numHSRel).col1 = GloWindow(windo).col1 - 1
  17.       HSRel(numHSRel).col2 = GloWindow(windo).col1 - 1
  18.       HSRel(numHSRel).action = 4
  19.       HSRel(numHSRel).misc = windo
  20.     END IF
  21.  
  22.     ' ====================================================================
  23.     ' If lower right corner is "+", then that's a re-size box
  24.     ' Further more, a re-size box is a click event, so store in HSClick
  25.     ' ====================================================================
  26.  
  27.     IF MID$(border$, 9, 1) = "+" THEN
  28.       numHSClick = numHSClick + 1
  29.       HSClick(numHSClick).row1 = GloWindow(windo).row2 + 1
  30.       HSClick(numHSClick).row2 = GloWindow(windo).row2 + 1
  31.       HSClick(numHSClick).col1 = GloWindow(windo).col2 + 1
  32.       HSClick(numHSClick).col2 = GloWindow(windo).col2 + 1
  33.       HSClick(numHSClick).action = 5
  34.       HSClick(numHSClick).misc = 0
  35.     END IF
  36.  
  37.     ' ====================================================================
  38.     ' Likewise, a "░" chr$(176) is a move bar.  That's also a click event
  39.     ' ====================================================================
  40.  
  41.     IF MID$(border$, 2, 1) = "░" THEN
  42.       numHSClick = numHSClick + 1
  43.       HSClick(numHSClick).row1 = GloWindow(windo).row1 - 1
  44.       HSClick(numHSClick).row2 = GloWindow(windo).row1 - 1
  45.       HSClick(numHSClick).col1 = GloWindow(windo).col1
  46.       HSClick(numHSClick).col2 = GloWindow(windo).col2
  47.       HSClick(numHSClick).action = 15
  48.       HSClick(numHSClick).misc = 0
  49.     END IF
  50.  
  51.     ' ====================================================================
  52.     ' Buttons are click, and release events.
  53.     ' Click, and the cursor goes there, and the button is highlighted.
  54.     ' Release, and the selection is made
  55.     ' ====================================================================
  56.  
  57.     IF GloStorage.numButtonsOpen > 0 THEN
  58.       button = 0
  59.       WHILE button < GloStorage.numButtonsOpen
  60.           button = button + 1
  61.           IF GloButton(button).windowHandle = windo THEN
  62.             numHSClick = numHSClick + 1
  63.             HSClick(numHSClick).row1 = _
  64.                      GloWindow(windo).row1 _
  65.                     + GloButton(button).row1 - 1
  66.             IF GloButton(button).buttonType = 5 THEN
  67.               HSClick(numHSClick).row2 = GloWindow(windo).row1 _
  68.                                  + GloButton(button).row2
  69.             ELSE
  70.               HSClick(numHSClick).row2 = GloWindow(windo).row1 _
  71.                                  + GloButton(button).row1 - 1
  72.             END IF
  73.             HSClick(numHSClick).col1 = GloWindow(windo).col1 _
  74.                                + GloButton(button).col1 - 1
  75.             HSClick(numHSClick).col2 = GloWindow(windo).col1 _
  76.                                + GloButton(button).col1 _
  77.                                + 2 _
  78.                                + LEN(RTRIM$(GloButton(button).text$))
  79.             HSClick(numHSClick).action = 1
  80.             HSClick(numHSClick).misc = GloButton(button).handle
  81.             HSClick(numHSClick).misc2 = GloButton(button).buttonType
  82.  
  83.             numHSRel = numHSRel + 1
  84.             HSRel(numHSRel).row1 = GloWindow(windo).row1 _
  85.                            + GloButton(button).row1 - 1
  86.             IF GloButton(button).buttonType = 5 THEN
  87.               HSRel(numHSRel).row2 = GloWindow(windo).row1 _
  88.                              + GloButton(button).row2 - 1
  89.             ELSE
  90.               HSRel(numHSRel).row2 = GloWindow(windo).row1 _
  91.                              + GloButton(button).row1 - 1
  92.             END IF
  93.             HSRel(numHSRel).col1 = GloWindow(windo).col1 _
  94.                            + GloButton(button).col1 - 1
  95.             HSRel(numHSRel).col2 = GloWindow(windo).col1 _
  96.                            + GloButton(button).col1 _
  97.                            + 2 _
  98.                            + LEN(RTRIM$(GloButton(button).text$))
  99.             HSRel(numHSRel).action = 1
  100.             HSRel(numHSRel).misc = GloButton(button).handle
  101.             HSRel(numHSRel).misc2 = GloButton(button).buttonType
  102.  
  103.             ' ========================================================
  104.             ' Adjust previous info to handle special cases for
  105.             ' "field" buttons, and "scroll bar" buttons.
  106.             ' ========================================================
  107.  
  108.             SELECT CASE GloButton(button).buttonType
  109.                 CASE 4
  110.                     numHSRel = numHSRel - 1
  111.                     HSClick(numHSClick).row2 = GloWindow(windo).row1 _
  112.                                        + GloButton(button).row2 - 1
  113.                     HSClick(numHSClick).col2 = GloWindow(windo).col1 _
  114.                                        + GloButton(button).col2 - 1
  115.                 CASE 5
  116. '                   numHSClick = numHSClick - 1
  117. '                   HSRel(numHSRel).row2 = GloWindow(windo).row1 _
  118. '                                  + GloButton(button).row2 - 1
  119. '                   HSRel(numHSRel).col2 = GloWindow(windo).col1 _
  120. '                                  + GloButton(button).col2 - 1
  121.                 CASE 6
  122.                     numHSRel = numHSRel - 1
  123.                     HSClick(numHSClick).row2 = GloWindow(windo).row1 _
  124.                                        + GloButton(button).row2 - 1
  125.                     HSClick(numHSClick).col2 = GloWindow(windo).col1 _
  126.                                        + GloButton(button).col1 - 1
  127.                 CASE 7
  128.                     numHSRel = numHSRel - 1
  129.                     HSClick(numHSClick).row2 = GloWindow(windo).row1 _
  130.                                        + GloButton(button).row1 - 1
  131.                     HSClick(numHSClick).col2 = GloWindow(windo).col1 _
  132.                                        + GloButton(button).col2 - 1
  133.                 CASE ELSE
  134.             END SELECT
  135.           END IF
  136.       WEND
  137.     END IF
  138.  
  139.     ' ====================================================================
  140.     ' EditFields are Click events
  141.     ' ====================================================================
  142.  
  143.     IF GloStorage.numEditFieldsOpen > 0 THEN
  144.         editField = 0
  145.         WHILE editField < GloStorage.numEditFieldsOpen
  146.             editField = editField + 1
  147.             IF GloEdit(editField).windowHandle = windo THEN
  148.                 numHSClick = numHSClick + 1
  149.                 HSClick(numHSClick).row1 = GloWindow(windo).row1 _
  150.                                    + GloEdit(editField).row - 1
  151.                 HSClick(numHSClick).row2 = GloWindow(windo).row1 _
  152.                                    + GloEdit(editField).row - 1
  153.                 HSClick(numHSClick).col1 = GloWindow(windo).col1 _
  154.                                    + GloEdit(editField).col - 1
  155.                 HSClick(numHSClick).col2 = GloWindow(windo).col1 _
  156.                                    + GloEdit(editField).col _
  157.                                    + GloEdit(editField).visLength - 1
  158.                 HSClick(numHSClick).action = 2
  159.                 HSClick(numHSClick).misc = GloEdit(editField).handle
  160.             END IF
  161.         WEND
  162.     END IF
  163.  
  164.     ' ====================================================================
  165.     ' Feel free to add your own hot spots!  One good idea is if the
  166.     ' right hand side of the border is ▓, make that a scroll bar!  Adding
  167.     ' that would be good practice -- and fun too!
  168.     ' ====================================================================
  169.  
  170. RETURN
  171.